import request from '@/utils/request'

// 创建备品备件
export function createSpares(data) {
  return request({
    url: '/ems/spares/create',
    method: 'post',
    data: data
  })
}

// 更新备品备件
export function updateSpares(data) {
  return request({
    url: '/ems/spares/update',
    method: 'put',
    data: data
  })
}

// 删除备品备件
export function deleteSpares(id) {
  return request({
    url: '/ems/spares/delete?id=' + id,
    method: 'delete'
  })
}

// 获得备品备件
export function getSpares(id) {
  return request({
    url: '/ems/spares/get?id=' + id,
    method: 'get'
  })
}

// 获得备品备件分页
export function getSparesPage(query) {
  return request({
    url: '/ems/spares/page',
    method: 'get',
    params: query
  })
}

// 导出备品备件 Excel
export function exportSparesExcel(query) {
  return request({
    url: '/ems/spares/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
